Skip to content

Final Merge with develop #26

Merged
Yosoyepa merged 75 commits intomainfrom
develop
Dec 4, 2025
Merged

Final Merge with develop #26
Yosoyepa merged 75 commits intomainfrom
develop

Conversation

@Yosoyepa
Copy link
Owner

@Yosoyepa Yosoyepa commented Dec 4, 2025

No description provided.

Yosoyepa and others added 30 commits November 27, 2025 02:23
- Add UserEntity with Clerk ID, rate limiting, and role management
- Add CodeReviewEntity with encrypted code storage support
- Add AgentFindingEntity with severity and quality metrics
- Create enums: SeverityEnum, UserRole aligned with PostgreSQL ENUMs
- Configure Alembic env.py for model discovery and autogenerate
- Implement relationships with cascade delete for data integrity

Related CGAI-15
- Create users table with Clerk ID, role, rate limiting fields
- Create code_reviews table with encrypted code storage
- Create agent_findings table with severity and metrics
- Add PostgreSQL ENUMs: userrole, reviewstatus, severityenum
- Add indexes for performance optimization
- Configure cascade delete for data integrity

Migration ID: ba48c1bb8e18
Related CGAI-15
feat(database): integrate Supabase PostgreSQL with SQLAlchemy models and Alembic migrations
- Add ClerkClient for JWT validation with HS256 algorithm
- Add UserRepository for CRUD operations on users table
- Add AuthService to orchestrate login and token validation
- Add auth dependency (get_current_user, get_optional_user)
- Add /api/v1/auth/login and /api/v1/auth/me endpoints
- Sync users from Clerk to Supabase on login
- Add email-validator dependency for pydantic EmailStr

Closes CGAI-28
feat(auth): Clerk JWT authentication with Supabase user sync

- Add ClerkClient for JWT validation with HS256 algorithm
- Add UserRepository for CRUD operations on users table
- Add AuthService to orchestrate login and token validation
- Add auth dependency (get_current_user, get_optional_user)
- Add /api/v1/auth/login and /api/v1/auth/me endpoints
- Sync users from Clerk to Supabase on login
- Add email-validator dependency for pydantic EmailStr

Closes CGAI-28
- Add 12 tests for UserRepository (get_by_id, create, update, delete)
- Add 10 tests for UserEntity (can_analyze, increment_analysis_count)
- Add 9 integration tests for auth endpoints (/login, /me)
- Coverage increased from 92% to 96%
- Add tests for CodeReviewEntity (__repr__, calculate_quality_score)
- Add tests for AgentFindingEntity (penalty, to_dict, __repr__)
- Add tests for get_db dependency (session lifecycle)
- Fix auth router tests to accept 401/403 for missing token
- Fix severity assertion to expect uppercase enum values

Coverage improvements:
- code_review.py: 89% -> 100%
- finding.py: 88% -> 100%
- get_db.py: 50% -> 100%

Total: 175 tests, 97.46% coverage
- Add tests for CodeReviewEntity (__repr__, calculate_quality_score)
- Add tests for AgentFindingEntity (penalty, to_dict, __repr__)
- Add tests for get_db dependency (session lifecycle)
- Fix auth router tests to accept 401/403 for missing token
- Fix severity assertion to expect uppercase enum values

Coverage improvements:
- code_review.py: 89% -> 100%
- finding.py: 88% -> 100%
- get_db.py: 50% -> 100%

Total: 175 tests, 97.46% coverage
- Implementar PylintAnalyzer y Flake8Analyzer para análisis externo
- Agregar detección de convenciones de nombres (snake_case, PascalCase)
- Agregar detección de imports duplicados y no usados
- Agregar detección de docstrings faltantes
- Agregar detección de líneas largas y trailing whitespace
- Emitir eventos AGENT_STARTED/COMPLETED/FAILED
- Ordenar findings por line_number (ascendente)
- Usar categorías de issue_type: style/pep8, style/documentation,
  style/imports, style/naming
- Agregar tests unitarios para StyleAgent (23 tests)
- Agregar tests de integración para StyleAgent (15 tests)
- Agregar tests para PylintAnalyzer y Flake8Analyzer
- Cobertura total: 94.66% (279 tests passing)

BREAKING CHANGE: ninguno

Closes CGAI-29
- Eliminar métodos de cobertura de código no utilizados
- Añadir pruebas de integración completas (5 tests pasados)
- Cobertura de pruebas unitarias alcanzada: 96%
- Eliminar credenciales hardcodeadas en scripts de prueba
- Verificar integración exitosa con el servicio de análisis

Related: CGAI-30-QualityAgent-code-quality-analysis
Yosoyepa and others added 26 commits December 3, 2025 21:58
…d in analysis process

Refactor(test_analysis_service): mock StyleAgent in tests for comprehensive agent coverage
…): clean up imports and improve logging format
…e-quality-analysis

Feature/cgai 30 quality agent code quality analysis
- Agregar OrchestratorAgent para coordinar ejecución de agentes

Related CGAI-13
… eficiencia

- Añadir PerformanceAgent para detectar complejidad algorítmica (bucles anidados O(n^2), O(n^3))
- Implementar detección de fugas de recursos (uso de open/socket sin context managers)
- Agregar validaciones para patrones N+1 queries y operaciones ineficientes en colecciones
- Integrar el agente en el flujo principal de AnalysisService para ejecución paralela
- Incluir pruebas unitarias

Relacionado con CGAI-31
…-code-performance-analysis

Feature/cgai 31 performance agent code performance analysis
…ltiples agentes y agregar sus hallazgos.

Implementación de la lógica en AnalysisService para utilizar OrchestratorAgent en lugar de agentes individuales.
Removed the Performance Agent analysis from the orchestrator process.
- Add GeminiClient for Vertex AI integration with gemini-1.5-flash/pro models
- Implement Model Context Protocol (MCP) with OWASP Top 10 security contexts
- Create AIService as orchestrator for AI-powered code analysis
- Add SecurityContext dataclass for structured prompt engineering
- Fix Clerk JWT authentication to support HS256 with Custom JWT Templates
- Update auth_service to use standard 'sub' claim from JWT payload
- Fix Severity enum to use uppercase values matching database schema
- Add comprehensive unit tests for AI components (88%+ coverage)
- Configure GCP credentials for Vertex AI authentication

BREAKING CHANGE: Severity enum values changed from lowercase to UPPERCASE

Closes CGAI-32
- Change severity ordering list from lowercase to UPPERCASE in performance_agent.py
- Update expected_order in integration test to match Severity enum values
- Fixes ValueError: 'HIGH' is not in list during findings sorting

The Severity enum uses UPPERCASE values ('CRITICAL', 'HIGH', etc.) but the
sorting list used lowercase, causing index lookup failures.

Fixes 2 failing tests:
- test_comprehensive_performance_detection
- test_detect_triple_nested_loops_critical
…rativeAI

feat(ai): integrate Vertex AI Gemini with MCP for code analysis
@Yosoyepa Yosoyepa added the enhancement New feature or request label Dec 4, 2025
Copy link
Collaborator

@jpastor1649 jpastor1649 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A mi me gusta bro

@Yosoyepa Yosoyepa merged commit d575c1a into main Dec 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants